M|Replay's REST API allows you to retrieve M|Replay's inputs and outputs, control the playback, create clips, etc... If you have additional needs, don't hesitate to reach out to us.
M|Replay uses port 8090 by default, but this can be configured in the preferences of M|Replay.
This API is meant to be RESTful, then, using different verbs on requests leads to different behaviour on request processing.
In general manner, consider theses verbs to have the described behaviour:
GET -> Retrieve data of a processable entity.
POST -> Create a new entity.
PUT -> Update a specified entity.
DELETE -> Delete an entity.
When you modify or retrieving data, be sure to handle properly the return code that is returned by the API as it indicates if the operation was successfull or not.
For POST & PUT requests you MUST supply the 'Content-Type' header with value 'application/json'.
Here is a short list common codes returned by the API:
| Code |
Meaning |
Description |
| 200 |
OK |
The request was succesfully processed. |
| 201 |
Created |
A new resource has been created on server side. |
| 202 |
Accepted |
The resquest was accepted but was not processed. |
| 400 |
Bad Request |
The resquest was not well formed. |
| 401 |
Unauthorized |
The request needs an access token to proceed. See Authorization |
| 403 |
Forbidden |
The token provided doesn't have sufficient privileges/permissions. See Authorization |
| 404 | Not found |
The resquest couldn't be processed. The path is not recognized. |
| 422 |
Unprocessable entity |
The resquest is well formed but is sementically incorrect |
To know if your request succeded; command, update, create and delete requests are followed with this kind of response:
Command response object:
{
"success" : boolean,
"error" : string OPTIONAL
}
"success": Indicates if the request was accepted and processed or not by M|Replay.
"error": In case of success false, indicates what was wrong when processing the request.
NOTE:
OPTIONAL marked parameters indicates that these parameters can be or not be present in the response object, this is due to internal logics.
However for requests that require a body, like PUT or POST, it means that it can be passed but they are not mandatory.
Since controlling your ingest can be sensitive content at a time, an authorization mechanism will be required if you decide to enable it in M|Replay's preferences. (General -> HTTP Remote Control -> Password -> Required).
If this feature is enabled, it implies that you have to send the password defined in M|Replay and send the password with each request.
So for example if your password is "1234", you will have to add it to your request:
GET http://localhost:8090/inputs?password=1234
To specify which output you are controlling, you can use in the url, either:
- its index ⓘ
- its name ⓘ
- "-1" for the "selected output"
To
specify which input, you can use in the body of the request, either (in order of priority in case you indicate multiple ones):
- its unique ID
- its index ⓘ
- its name
Each clip, marker or playlist can be addressed using either its unique_id, its index or eventually its display name.
- The unique_id is the safest way as it will not change and remain unique, but you have to request first its value before being able to send arguments.
- The index of a clip is the (zero based) position of a clip, or the order in which the playlists are displayed on screen (0 is the first playlist open, 1 is the second playlist open, etc...)
- The display name is the name given to a clip inside M|Replay. But pay attention that if you have mutiple clips with the same name, it will always address to the first one (in index order). Should be used as a convenience way or when you are sure the name is unique witthin the playlist.
Get info about M|Replay
You can get some info about the application itself
GET http://localhost:8090/info
Response:
{
"time_zone": string, eg: "Europe\/Brussels" ⓘ
"computer_name": string, eg: "Admin's computer" ⓘ
"application_name": string, eg: "M|Replay" ⓘ
"application_build_number": string, eg: "402090" ⓘ
"mac_os_version": string, eg: "14.1" ⓘ
"application_in_demo": boolean ⓘ,
"application_version": string eg: "4.2" ⓘ
}
Get info about the current session
And you can get some useful information about the current session as well with the following request:
GET http://localhost:8090/status
Response:
{
"playback_rate" : number, eg: "0" ⓘ
"remaining_time" : number, eg: "1151.04" ⓘ
"remaining_timecode" : string, eg: "00:00:00:00" ⓘ
"current_time" : number, eg: "1151.04" ⓘ
"current_timecode" : string, eg: "00:00:00:00" ⓘ
"playhead_time" : number, eg: "1151.04" ⓘ
"playhead_timecode" : string, eg: "16:54:43:01" ⓘ
"delay_time": number, eg: "0.00" ⓘ
"delay_timecode": string, eg: "16:54:43:01" ⓘ
"drop_frame" : boolean, ⓘ
"loop_recording" : boolean, ⓘ
"framerate" : number, eg: "25" ⓘ
"remaining_space" : string, eg: "Remaining Space: 404 GB" ⓘ
}
Retrieve the list of available inputs or outputs
To retrieve the list of available inputs:
GET http://localhost:8090/inputs
Response:
[
{
"name" : string, eg: "Camera 1" ⓘ
"unique_id" : string, eg: "FDK3LAFVJFBS68" ⓘ
"enabled" : boolean ⓘ
}
]
To retrieve the list of available inputs:
GET http://localhost:8090/outputs
Response:
[
{
"name" : string, eg: "Output 1" ⓘ
"unique_id" : string, eg: "MGFLDGHKFINGQFHDJ" ⓘ
"device_type" : number, ⓘ
"enabled" : boolean, ⓘ
"selected" : boolean, ⓘ
"input_unique_id" : "Camera 1" ⓘ
}
]
Defining which output is selected
In M|Replay, one of your output can be the selected one. This means it will be the one reacting to keyboard shortcuts, or to XC8, or to some REST requests. So it is important to change this with care. To set which output is selected, you have to use the following command:
PUT http://localhost:8090/outputs/{n}
Body:
{
"selected": boolean, ⓘ
}
Assigning an input to an output
The following command can be used to assign an input to an output, and you can use the input UID, index, or name
Using input "Unique ID"
PUT http://localhost:8090/outputs/{n}
Body:
{
"input_unique_id": string, eg: "GQDFLAKLK45L45"
}
Using input "Index"
PUT http://localhost:8090/outputs/{n}
Body:
{
"input_index": number, eg: "2" ⓘ
}
Using input "Name"
PUT http://localhost:8090/outputs/{n}
Body:
{
"input_name": string, eg: "My Camera 01"
}
Note that if you specify more than one parameter (for example if you indicate both the input unique id and its name), the priority will be first the unique id, then index, then name.
During half time, you may want to keep the session running and available, but stop the recording on specific inputs or on all inputs at once. During that time no video will be recorded to disk, and when you want to replay that section, it will be black.
Pause or resume recording on all inputs
To pause the recording on all inputs:
GET http://localhost:8090/inputs/pause
To pause the resume recording on all inputs:
GET http://localhost:8090/inputs/resume
Pause or resume Recording on a specific input:
To pause the recording on all inputs:
GET http://localhost:8090/inputs/{n}/pause
To pause the resume recording on a specific input:
GET http://localhost:8090/inputs/{n}/resume
About the time references, and values
For Clips and Markers
When creating clips or markers, to indicate at which position they should be created, you will have to set what reference to use, either:
- "live": the clip/marker will be set at the current "Live" time, even if the user has scrubbed and is playing back at a different position.
- "playhead": the clip/marker will be set at the position of the playhead (if the user has used the jog shuttle, and is playing back in time, it will be logged at that position).
- "absolute": the clip/marker will be set at the time indicated in the "time" value you pass in the JSON.
For Playhead position - Go to time
When controlling the position of the playhead, you can use the following kind of request. This will do the same thing as when clicking in the "Current Time" field in the user interface and where you can enter an "absolute" timecode to go to that timecode, or a relative time to go one hour back for example. You will set the position of the playhead and also indicate in reference to what this value should be applied:
- "live": the playhead will move to a position relative to the "Live" time, even if the user has scrubbed and is playing back at a different position. This is ideal if you know you need to go to 1 hour prior to live time for example. If you set the time to 0, it will go to Live.
- "playhead": the playhead will move to a position relative to the current position of the playhead (if the user has used the jog shuttle, and is playing back in time, it will be logged at that position). This is what you should use if you want to fine tune, and for example move just 10 seconds back compared to where you are currently.
- "absolute": the playhead will move to an absolute position. This is what you will use if you know at which timecode you want to jump to. If you want to go to 8PM for example.
- "in_point": the playhead will move to a position relative to the current value of the in point (before a clip is created). Allowing you to quickly jump back to that position.
- "out_point": the playhead will move to a position relative to the current value of the out point (before a clip is created). Allowing you to quickly jump back to that position.
Seconds, Timecode, positive or negative
Additionally to the reference, you will define either an offset relative to that reference, or an absolute time:
- When using "live", "playhead", "in_point", or "out_point", you must also specify an "offset", even if it is zero. It can be either positive or negative
- When using "absolute" time, you must specify a "time" value. It can only be positive. You should also make sure that the TC you indicate is within the range of the session.
You can use either seconds or timecode, and these values can be positive or negative. Note that nothing will need to be specified, we will interpret according to what we receive):
- seconds: You can set the position in seconds. Just enter something like 10 for 10 seconds, 3600 for one hour, etc.
- timecode: You can set the position using timecode. As the : don't go well in an URL, replace them with %3A. So a 01:00:00:00 timecode will look like this: 01%3A00%3A00%3A00
- positive or negative: set a negative value if you want to go in the past, and a positive value to go in the future. Of course an "absolute" timecode will only be positive as it's not relative to a previous time.
Working with Markers - In Browser
Creating markers
See above for the different time references and values.
POST http://localhost:8090/markers
Body:
{
"name": string, eg: "My Marker" ⓘ
"unique_id": string, eg: "AZ21334-FGFGHGR-143356778" ⓘ
"reference": string, ⓘ
"time": string, eg: "00:00:00:00" ⓘ
"offset": string, eg: "00:00:00:00" ⓘ
"input_unique_id": string, eg: "3813338208-0" ⓘ
}
Modifying markers
When modify a marker, you will have to use PUT, and then you can pass any of the keys below to change their name, or position.
PUT http://localhost:8090/markers/{n}
Retrieving markers
You can retrieve all the markers:
GET http://localhost:8090/markers
You can also retrieve just a specific marker, by indicating its index, unique_id or name:
GET http://localhost:8090/markers/{n}
Working with Clips - In Browser
Creating clips
See above for the different time references and values.
When creating a clip, you will have to specify a duration, or an in, or out point. You will have to specify 2 of them.
POST http://localhost:8090/clips
Body:
{
"name": string, eg: "My Clip" ⓘ
"unique_id": string, eg: "AZ21334-FGFGHGR-143356778" ⓘ
"reference_in_point": string, ⓘ
"in_point": string, Timecode value - eg: "-00:00:10:00" ⓘ
"reference_out_point": string, ⓘ
"out_point": string, Timecode value - eg: "00:00:00:00" ⓘ
"duration": string, Timecode value - eg: "00:00:10:00" ⓘ
"unique_name": boolean ⓘ
"input_unique_id": string, eg: "3813338208-0" ⓘ
}
Modifying clips
When modify a clip, you will have to use PUT, and then you can pass any of the keys below to change their name, or in/out points.
PUT http://localhost:8090/clips{n}
Retrieving clips
You can retrieve all the clips:
GET http://localhost:8090/clips
You can also retrieve just a specific clip, by indicating its index, unique_id or name:
GET http://localhost:8090/clips/{n}
Working with Playlists
Creating Playlists
You can create empty playlists. OR you can immediately add clips to your playlists when creating it. You can use either 'external' clips, or 'internal' ones.
POST http://localhost:8090/playlists
Body:
{
"chain": boolean, ⓘ
"loop": boolean, ⓘ
"unique_id": string, eg: "AZ21334-FGFGHGR-143356778" ⓘ
"name": string, eg: "Playlist 1" ⓘ
"items": an array of clips. OPTIONAL. See the 'Adding clips to playlists' section for more info.
}
Modifying Playlists
PUT http://localhost:8090/playlists/{n}
Deleting Playlists
DELETE http://localhost:8090/playlists/{n}
Retrieving playlists
You can retrieve all the playlists:
GET http://localhost:8090/playlists
You can also retrieve just a specific playlist, by indicating its index:
GET http://localhost:8090/playlists/{n}
Working with Clips - In Playlists
Adding clips to Playlists
You can add a clip at the end of the playlist, by not indicating any index:
POST http://localhost:8090/playlists/{n}/items
You can add a clip at a specific position in the playlist, by indicating an index at which you want to add the clip in the playlist:
POST http://localhost:8090/playlists/{n}/items/{indexOfClipInPlaylist}
For the body of the request, you can either add an internal clip (from the session's browser):
Body:
{
"unique_id": string, eg: "AZ21334-FGFGHGR-143356778" ⓘ
"playback_rate": integer, eg: 50 ⓘ
"browser_item_unique_id":string,eg: "F62AF042-28BF-4113-9334-664096779E04" ⓘ
"input_unique_id": string, eg: "3813338208-0" ⓘ
}
Or an external clip (From the Finder)
Body:
{
"unique_id": string, eg: "AZ21334-FGFGHGR-143356778" ⓘ
"file_url": string, eg: "/Volumes/Videos/MyVideo.mov" ⓘ
}
Modifying clips in Playlists
PUT http://localhost:8090/playlists/{n}/items/{m}
For the body of the request, you can either modify an internal clip (from the session's browser):
Or an external clip (From the Finder)
Deleting Clips in Playlists
DELETE http://localhost:8090/playlists/{n}/items/{m}
Retrieving clips in playlists
You can retrieve all the playlists:
GET http://localhost:8090/playlists/{n}/items
Or
You can also retrieve just a specific clip, by indicating its index in the playlist:
GET http://localhost:8090/playlists/{n}/items/{m}
Or
Controlling Playback - In the Viewers
Playback Rate
You can use the following kind of request to control the playback rate in the viewers. 0 is stopped, 1 is normal playback speed, -1 is normal playback speed backwards, you can use positive or negative values up to 64. For example:
Stop playback
GET http://localhost:8090/set_playback_rate?rate=0
Play forward at 1x
GET http://localhost:8090/set_playback_rate?rate=1
Play backwards at 32x
GET http://localhost:8090/set_playback_rate?rate=-32
Playhead position - Go to time
See above for the different time references and values. Below are a few examples:
Go to Live
GET http://localhost:8090/set_position?position=0&reference=live
Go to 1 hour before Live, using seconds
GET http://localhost:8090/set_position?position=-3600&reference=live
Go to 1 hour before Live, using timecode
GET http://localhost:8090/set_position?position=-01%3A00%3A00%3A00&reference=live
Go to 10 seconds before the current playhead position, using seconds
GET http://localhost:8090/set_position?position=-10&reference=playhead
Go to time code 16:30:10:10
GET http://localhost:8090/set_position?position=16%3A30%3A10%3A10&reference=absolute
Go to 5 seconds before the in point, using seconds
GET http://localhost:8090/set_position?position=-5&reference=in_point
Controlling Playback - In the playlists
Play a playlist
GET http://localhost:8090/playlists/{n}/play
Pause a playlist
GET http://localhost:8090/playlists/{n}/pause
Stop a playlist
GET http://localhost:8090/playlists/{n}/play
Skipt to the previous clip in a playlist
GET http://localhost:8090/playlists/{n}/skip_previous
Skipt to the next clip in a playlist
GET http://localhost:8090/playlists/{n}/skip_next
Play a specific clip in the playlist
GET http://localhost:8090/playlists/{n}/items/{m}/play
Pause a playlist
GET http://localhost:8090/playlists/{n}/items/{m}/pause